package com.ip.getip.controller;

import com.ip.getip.service.impl.Aria2RPC;
import com.ip.getip.service.impl.DDnsImpl;
import com.ip.getip.service.impl.FileImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    //    @Autowired
//    UserService userService;
    @Autowired
    FileImpl file;
    @Autowired
    DDnsImpl dDns;
    @Autowired
    Aria2RPC aria2RPC;
//    @Autowired
//    Xvideos xvideos;

//    @GetMapping(value = "get")
//    public String get(String path) {
//        userService.get(new File(path));
//        return "成功";
//    }

    @GetMapping(value = "file")
    public String file() throws Exception {
        return file.fileImg();
    }

    @GetMapping(value = "ddns")
    public String ddns() throws Exception {
        dDns.getIp();
        return "点击成功";
    }

//    @GetMapping(value = "videos")
//    public String videos() throws Exception {
//        xvideos.service();
//        return "点击成功";
//    }

    @GetMapping(value = "downs")
    public String downsAria2(@RequestParam(name = "url", required = true) String url,
        @RequestParam(name = "name", required = true) String name) {

        return aria2RPC.aria2(url, name);
    }
}
